package com.jiaquyun.jcyx.jetpack.api

import com.jiaquyun.jcyx.app.JCApplication
import com.jiaquyun.jcyx.base.BaseManager
import com.module.lemlin.http.HttpResponseData
import rxhttp.RxHttp
import rxhttp.await

class CouponRepository : BaseManager() {

    /**
     * 优惠券列表
     * */
    suspend fun couponUserCouponList(status: String): HttpResponseData =
        RxHttp.postForm("/api/coupon/userCouponList")
            .add("status", status)
            .await()

    /**
     * 领券中心
     * */
    suspend fun couponScoreCouponList(): HttpResponseData =
        RxHttp.get("/api/coupon/scoreCouponList")
            .await()

    /**
     * 优惠券兑换
     * */
    suspend fun couponGetCoupon(
        id: String
    ): HttpResponseData = RxHttp.postForm("/api/coupon/getCoupon")
        .add("id", id)
        .add("shop_id", JCApplication.userShops?.id?:"55")
        .await()
}
